// JavaScript Document
window.onload=function()
{
	var leftBut=document.getElementById("switch_left");
	var rightBut=document.getElementById("switch_right");
	var oul=document.getElementById("switch_ul");
	var ali=oul.getElementsByTagName("li");
	var num=1;//一次切换数量，随意改
	var oneSize=ali[0].offsetWidth+20;
	var butTrue=true;
	function oulSize()
	{
		oul.style.width=oneSize*ali.length+"px";
	}
	oulSize();
	function ulmove()
	{
		if(butTrue)
		{
			butTrue=false;
			for(var i=0;i<num;i++)
			{
				var oli=ali[i].cloneNode(true);
				oul.appendChild(oli);
				oulSize();
			}
			startMove(oul,{left:-(oneSize*num)},function(){for(var i=0;i<num;i++){oul.removeChild(ali[0]);oul.style.left=0;}butTrue=true;});
		}
	}
	notIntervalId = setInterval(ulmove,1500);
	leftBut.onclick=function()
	{
		ulmove();
	}
	rightBut.onclick=function()
	{
		if(butTrue)
		{
			butTrue=false;
			var gs=ali.length-1;
			for(var i=0;i<num;i++)
			{
				var gs=ali.length-1;
				var oli=ali[gs-i].cloneNode(true);
				oul.insertBefore(oli,ali[0]);
				oulSize();
			}
			oul.style.left=-(oneSize*num)+"px";
			startMove(oul,{left:0},function(){for(var i=0;i<num;i++){var gs=ali.length-1;oul.removeChild(ali[gs]);oul.style.left=0;}butTrue=true;});			
		}
	}
	leftBut.onmouseout=function()
	{
		notIntervalId = setInterval(ulmove,1500);
	}
	rightBut.onmouseout=function()
	{
		notIntervalId = setInterval(ulmove,1500);
	}
	leftBut.onmouseover=function()
	{
		clearInterval(notIntervalId);
	}
	rightBut.onmouseover=function()
	{
		clearInterval(notIntervalId);
	}
	document.getElementById("switch_div").onmouseout=function()
	{
		notIntervalId = setInterval(ulmove,1500);
	}
	document.getElementById("switch_div").onmouseover=function()
	{
		clearInterval(notIntervalId);
	}
}